package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.ParkingRentRuleDO;

import javax.validation.constraints.NotNull;

/**
 * Created by well on 15/11/12.
 */
public class ParkingRentRuleEditForm extends ParkingRentRuleForm{

    @NotNull(message = "不能为空")
    private Long ruleId;

    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public void initForm(ParkingRentRuleDO parkingRentRuleDO){
        setRuleId(parkingRentRuleDO.getRuleId());
        setRuleStatus(parkingRentRuleDO.getRuleStatus());
        setVarId(parkingRentRuleDO.getVarId());
        setFeeUnit(PriceUtil.formatCNY(parkingRentRuleDO.getFeeUnit()));
        setVillageId(parkingRentRuleDO.getVillageId());
    }

    public ParkingRentRuleDO toDO() {
        ParkingRentRuleDO parkingRentRuleDO = super.toDO();
        parkingRentRuleDO.setRuleId(ruleId);
        return parkingRentRuleDO;
    }
}
